Client Report - Project 0: Introduction

Course DS 250

Author

Tomas Fernandez

Show the code
# Learn more about Code Cells: https://quarto.org/docs/reference/cells/cells-jupyter.html

# Include and execute your code here
from palmerpenguins import load_penguins
df = load_penguins()

QUESTION|TASK 1

Include the tables created from PY4DS: CH2 Data Visualization used to create the above chart (Hint: copy the code from 2.2.1. The penguins data frame and paste each in the cells below)

Show the code
# Include and execute your code here
import pandas as pd
import numpy as np
from lets_plot import *
from palmerpenguins import load_penguins

# Load the Palmer Penguins dataset
penguins = load_penguins()

# Display the first few rows of the dataset for inspection
print("Preview of Palmer Penguins dataset:")
print(penguins.head())

# Setup LetsPlot for HTML rendering
LetsPlot.setup_html(isolated_frame=True) 
Preview of Palmer Penguins dataset:
  species     island  bill_length_mm  bill_depth_mm  flipper_length_mm  \
0  Adelie  Torgersen            39.1           18.7              181.0   
1  Adelie  Torgersen            39.5           17.4              186.0   
2  Adelie  Torgersen            40.3           18.0              195.0   
3  Adelie  Torgersen             NaN            NaN                NaN   
4  Adelie  Torgersen            36.7           19.3              193.0   

   body_mass_g     sex  year  
0       3750.0    male  2007  
1       3800.0  female  2007  
2       3250.0  female  2007  
3          NaN     NaN  2007  
4       3450.0  female  2007  
Show the code
import pandas as pd
import numpy as np
from lets_plot import *
from palmerpenguins import load_penguins

# Load the Palmer Penguins dataset
penguins = load_penguins()

# Display the first few rows of the dataset for inspection
print(penguins['species'])  # Corrected line

# Setup LetsPlot for HTML rendering
LetsPlot.setup_html(isolated_frame=True)
0         Adelie
1         Adelie
2         Adelie
3         Adelie
4         Adelie
         ...    
339    Chinstrap
340    Chinstrap
341    Chinstrap
342    Chinstrap
343    Chinstrap
Name: species, Length: 344, dtype: object

QUESTION|TASK 2

Recreate the example charts from PY4DS: CH2 Data Visualization of the textbook. (Hint: copy the chart code from 2.2.3. Creating a Plot, one for each cell below)

Show the code
# Include and execute your code here
import pandas as pd
import numpy as np
from lets_plot import *
from palmerpenguins import load_penguins


penguins = load_penguins()
penguinspecies = penguins['species']


# Create a basic plot 
(
    ggplot(data=penguins, mapping=aes(x="bill_depth_mm", y="body_mass_g"))
    + geom_point(aes(color="species", shape="species"))
    + geom_smooth(method="lm")
    + labs(
        title="Body mass and Bill depth",
        subtitle="Dimensions for Adelie, Chinstrap, and Gentoo Penguins",
        x="Bill depth (mm)",
        y="Body mass (g)",
        color="Species",
        shape="Species",
    )
)

This code reates a scatter plot to visualize the relationship between Bill depth and body mass of penguins using the Palmer Penguins dataset. ↑

Show the code
# Include and execute your code here

import pandas as pd
import numpy as np
from lets_plot import *
from palmerpenguins import load_penguins


penguins = load_penguins()
penguinspecies = penguins['species']

(
    ggplot(data=penguins, mapping=aes(x="flipper_length_mm", y="body_mass_g"))
    + geom_point(aes(color="species", shape="species"))
    + geom_smooth(method="lm")
    + labs(
        title="Body mass and flipper length",
        subtitle="Dimensions for Adelie, Chinstrap, and Gentoo Penguins",
        x="Flipper length (mm)",
        y="Body mass (g)",
        color="Species",
        shape="Species",
    )
)

This code reates a scatter plot to visualize the relationship between flipper length and body mass of penguins using the Palmer Penguins dataset. ↑